import { hasAuthority, hasRole, hasProduct } from '../utils/authority';
import { Badge } from 'antd';

const menuData = [
  {
    name: '首页',
    icon: 'home',
    path: 'homePage',
    authority: () => hasAuthority('/homePage'),
    // hideInMenu: true,
  },
  {
    name: '账户',
    icon: 'user',
    path: 'user',
    authority: ['admin', 'merchant', 'guest'],
    hideInMenu: true,
    children: [
      {
        name: '登录',
        path: 'login',
        authority: ['admin', 'guest'],
      },
    ],
  },

  {
    name: '商品中心',
    icon: 'appstore-o',
    path: 'productManagement',
    authority: () => hasAuthority('/productManagement'),
    children: [
      {
        name: '商品管理',
        path: 'product',
        authority: () => hasAuthority('/productManagement/product'),
      }, {
        name: '商品分组',
        path: 'productCategory',
        authority: () => hasAuthority('/productManagement/productCategory'),
      }, {
        name: '商品发布',
        path: 'productJD',
        authority: () => hasAuthority('/productManagement/productJD'),
      },
    ],
  },
  {
    name: '订单中心',
    icon: 'profile',
    path: 'orderManagement',
    authority: () => hasAuthority('/orderManagement'),
    children: [
      {
        name: '所有订单',
        path: 'businessOrder',
        authority: () => hasAuthority('/orderManagement/businessOrder'),
      }, {
        name: '退款维权',
        path: 'refundOrder',
        authority: () => hasAuthority('/orderManagement/refundOrder'),
      // }, {
      //   name: '分期待还',
      //   path: 'instalmentWaitPayOrder',
      //   authority: () => hasAuthority('/orderManagement/instalmentWaitPayOrder'),
      // }, {
      //   name: '分期已还',
      //   path: 'instalmentAlreadyPayOrder',
      //   authority: () => hasAuthority('/orderManagement/instalmentAlreadyPayOrder'),
      },
    ],
  },
  // {
  //   name: '用户中心',
  //   icon: 'profile',
  //   path: 'userManagement',
  //   authority: () => hasAuthority('/userManagement'),
  //   children: [
  //     // {
  //     //   name: '转化详情',
  //     //   path: 'conversionDetail',
  //     //   authority: () => hasAuthority('/userManagement/conversionDetail'),
  //     // },
  //     {
  //       name: '数据统计',
  //       path: 'conversionGeneral',
  //       authority: () => hasAuthority('/userManagement/conversionGeneral'),
  //     },
  //     {
  //       name: '信用审批',
  //       path: 'creditCheck',
  //       authority: () => hasAuthority('/userManagement/creditCheck'),
  //     },
  //     // {
  //     //   name: '用户列表',
  //     //   path: 'userList',
  //     //   authority: () => hasAuthority('/userManagement/userList'),
  //     // },
  //   ],
  // },
  // {
  //   name: '财务中心',
  //   icon: 'pay-circle',
  //   path: 'financeCenter',
  //   authority: () => hasAuthority('/financeCenter'),
  //   children: [
  //     {
  //       name: '消费明细',
  //       path: 'expenseDetail',
  //       authority: () => hasAuthority('/financeCenter/expenseDetail'),
  //     },
  //   ],
  // },
  // {
  //   name: '会员中心',
  //   icon: 'team',
  //   path: 'customerManagement',
  //   authority: () => hasAuthority('/customerManagement'),
  //   children: [
  //     {
  //       name: '会员管理',
  //       path: 'customer',
  //       authority: () => hasAuthority('/customerManagement/customer'),
  //     }, {
  //       name: '违约记录',
  //       path: 'breach',
  //       authority: () => hasAuthority('/customerManagement/breach'),
  //     }, {
  //       name: '账户详情',
  //       path: 'account',
  //       authority: () => hasAuthority('/customerManagement/account'),
  //     },
  //   ],
  // },

  {
    name: '消息中心',
    icon: 'message',
    path: 'messageManagement',
    authority: () => hasAuthority('/messageManagement'),
    children: [
      {
        name: '客服消息',
        path: 'customerServiceMessage',
        authority: () => hasAuthority('/messageManagement/customerServiceMessage'),
      }, {
        name: '通知',
        path: 'notice',
        authority: () => hasAuthority('/messageManagement/notice'),
      }, {
        name: '用户反馈',
        path: 'customerFeedback',
        authority: () => hasAuthority('/messageManagement/customerFeedback'),
      },
    ],
  },
  // {
  //   name: '数据中心（sdfz）',
  //   icon: 'pie-chart',
  //   path: 'statisticsCenter',
  //   authority: () => hasAuthority('/statisticsCenter'),
  //   children: [
  //     // {
  //     //   name: '转化统计',
  //     //   path: 'conversionData',
  //     //   // extra: (openKeys, props) => {
  //     //   //   const count = props.noticeCount;
  //     //   //   if (openKeys.indexOf('assetsManagement') > -1) {
  //     //   //     return (<Badge style={{ marginTop: '-3px', marginLeft: '18px', boxShadow: '0 0 0 2px #fff' }} count={count} />);
  //     //   //   }
  //     //   //   return null;
  //     //   // },
  //     //  authority: () => hasAuthority('/statisticsCenter/conversionData'),
  //     // },
  //     {
  //       name: '今日统计',
  //       path: 'loanStatistics',
  //      authority: () => hasAuthority('/statisticsCenter/loanStatistics'),
  //     },
  //     // {
  //     //   name: '逾期统计',
  //     //   path: 'overdueStatistics',
  //     //   authority: () => hasAuthority('/statisticsCenter/overdueStatistics'),
  //     // },
  //     {
  //       name: '回款统计',
  //       path: 'backStatistics',
  //       authority: () => hasAuthority('/statisticsCenter/backStatistics'),
  //     },
  //     {
  //       name: '毛利润统计',
  //       path: 'grossProfit',
  //       authority: () => hasAuthority('/statisticsCenter/grossProfit'),
  //     },
  //     // {
  //     //   name: '风控统计',
  //     //   path: 'riskManagement',
  //     //   authority: () => hasAuthority('/statisticsCenter/riskManagement'),
  //     // },
  //   ],
  // },
  // {
  //   name: '数据中心（想美）',
  //   icon: 'pie-chart',
  //   path: 'statisticsCenterForXBeauty',
  //   authority: () => hasAuthority('/statisticsCenterForXBeauty'),
  //   children: [
  //     // {
  //     //   name: '转化统计',
  //     //   path: 'conversionData',
  //     //  authority: () => hasAuthority('/statisticsCenterForXBeauty/conversionData'),
  //     // },
  //     {
  //       name: '今日统计',
  //       path: 'loanStatistics',
  //      authority: () => hasAuthority('/statisticsCenterForXBeauty/loanStatistics'),
  //     },
  //     // {
  //     //   name: '逾期统计',
  //     //   path: 'overdueStatistics',
  //     //   authority: () => hasAuthority('/statisticsCenterForXBeauty/overdueStatistics'),
  //     // },
  //     {
  //       name: '回款统计',
  //       path: 'backStatistics',
  //       authority: () => hasAuthority('/statisticsCenterForXBeauty/backStatistics'),
  //     },
  //     {
  //       name: '毛利润统计',
  //       path: 'grossProfit',
  //       authority: () => hasAuthority('/statisticsCenterForXBeauty/grossProfit'),
  //     },
  //     // {
  //     //   name: '风控统计',
  //     //   path: 'riskManagement',
  //     //   authority: () => hasAuthority('/statisticsCenterForXBeauty/riskManagement'),
  //     // },
  //   ],
  // },
  // {
  //   name: '数据中心（信花花）',
  //   icon: 'pie-chart',
  //   path: 'statisticsCenterForXflower',
  //   authority: () => hasAuthority('/statisticsCenterForXflower'),
  //   children: [
  //     // {
  //     //   name: '转化统计',
  //     //   path: 'conversionData',
  //     //  authority: () => hasAuthority('/statisticsCenterForXflower/conversionData'),
  //     // },
  //     {
  //       name: '今日统计',
  //       path: 'loanStatistics',
  //      authority: () => hasAuthority('/statisticsCenterForXflower/loanStatistics'),
  //     },
  //     // {
  //     //   name: '逾期统计',
  //     //   path: 'overdueStatistics',
  //     //   authority: () => hasAuthority('/statisticsCenterForXflower/overdueStatistics'),
  //     // },
  //     {
  //       name: '回款统计',
  //       path: 'backStatistics',
  //       authority: () => hasAuthority('/statisticsCenterForXflower/backStatistics'),
  //     },
  //     {
  //       name: '毛利润统计',
  //       path: 'grossProfit',
  //       authority: () => hasAuthority('/statisticsCenterForXflower/grossProfit'),
  //     },
  //     // {
  //     //   name: '风控统计',
  //     //   path: 'riskManagement',
  //     //   authority: () => hasAuthority('/statisticsCenterForXflower/riskManagement'),
  //     // },
  //   ],
  // },
  // {
  //   name: '数据中心（有点）',
  //   icon: 'pie-chart',
  //   path: 'statisticsCenterForUpoint',
  //   authority: () => hasAuthority('/statisticsCenterForUpoint'),
  //   children: [
  //     // {
  //     //   name: '转化统计',
  //     //   path: 'conversionData',
  //     //  authority: () => hasAuthority('/statisticsCenterForUpoint/conversionData'),
  //     // },
  //     {
  //       name: '今日统计',
  //       path: 'loanStatistics',
  //      authority: () => hasAuthority('/statisticsCenterForUpoint/loanStatistics'),
  //     },
  //     // {
  //     //   name: '逾期统计',
  //     //   path: 'overdueStatistics',
  //     //   authority: () => hasAuthority('/statisticsCenterForUpoint/overdueStatistics'),
  //     // },
  //     {
  //       name: '回款统计',
  //       path: 'backStatistics',
  //       authority: () => hasAuthority('/statisticsCenterForUpoint/backStatistics'),
  //     },
  //     {
  //       name: '毛利润统计',
  //       path: 'grossProfit',
  //       authority: () => hasAuthority('/statisticsCenterForUpoint/grossProfit'),
  //     },
  //     // {
  //     //   name: '风控统计',
  //     //   path: 'riskManagement',
  //     //   authority: () => hasAuthority('/statisticsCenterForUpoint/riskManagement'),
  //     // },
  //   ],
  // },
  // {
  //   name: '渠道中心（sdfz）',
  //   icon: 'bar-chart',
  //   path: 'channelCenter',
  //   authority: () => hasAuthority('/channelCenter'),
  //   children: [
  //     {
  //       name: '渠道统计',
  //       path: 'channelConversion',
  //       // path: 'channelStatistics',
  //       // extra: (openKeys, props) => {
  //       //   const count = props.noticeCount;
  //       //   if (openKeys.indexOf('assetsManagement') > -1) {
  //       //     return (<Badge style={{ marginTop: '-3px', marginLeft: '18px', boxShadow: '0 0 0 2px #fff' }} count={count} />);
  //       //   }
  //       //   return null;
  //       // },
  //       authority: () => hasAuthority('/channelCenter/channelStatistics'),
  //     },
  //     {
  //       name: '渠道转化',
  //       path: 'channelStatistics',
  //       // path: 'channelConversion',
  //       // extra: (openKeys, props) => {
  //       //   const count = props.noticeCount;
  //       //   if (openKeys.indexOf('assetsManagement') > -1) {
  //       //     return (<Badge style={{ marginTop: '-3px', marginLeft: '18px', boxShadow: '0 0 0 2px #fff' }} count={count} />);
  //       //   }
  //       //   return null;
  //       // },
  //       authority: () => hasAuthority('/channelCenter/channelConversion'),
  //     },
  //   ],

  // },
  // {
  //   name: '渠道中心（想美）',
  //   icon: 'bar-chart',
  //   path: 'ChannelCenterForXBeauty',
  //   authority: () => hasAuthority('/ChannelCenterForXBeauty'),
  //   children: [
  //     {
  //       name: '渠道统计',
  //       path: 'channelConversion',
  //       authority: () => hasAuthority('/ChannelCenterForXBeauty/channelStatistics'),
  //     },
  //     {
  //       name: '渠道转化',
  //       path: 'channelStatistics',
  //       authority: () => hasAuthority('/ChannelCenterForXBeauty/channelConversion'),
  //     },
  //   ],
  // },
  // {
  //   name: '渠道中心（信花花）',
  //   icon: 'bar-chart',
  //   path: 'ChannelCenterForXflower',
  //   authority: () => hasAuthority('/ChannelCenterForXflower'),
  //   children: [
  //     {
  //       name: '渠道统计',
  //       path: 'channelConversion',
  //       authority: () => hasAuthority('/ChannelCenterForXflower/channelStatistics'),
  //     },
  //     {
  //       name: '渠道转化',
  //       path: 'channelStatistics',
  //       authority: () => hasAuthority('/ChannelCenterForXflower/channelConversion'),
  //     },
  //   ],
  // },
  // {
  //   name: '渠道中心（有点）',
  //   icon: 'bar-chart',
  //   path: 'ChannelCenterForUpoint',
  //   authority: () => hasAuthority('/ChannelCenterForUpoint'),
  //   children: [
  //     {
  //       name: '渠道统计',
  //       path: 'channelConversion',
  //       authority: () => hasAuthority('/ChannelCenterForUpoint/channelStatistics'),
  //     },
  //     {
  //       name: '渠道转化',
  //       path: 'channelStatistics',
  //       authority: () => hasAuthority('/ChannelCenterForUpoint/channelConversion'),
  //     },
  //   ],
  // },
  // {
  //   name: '金融中心（sdfz）',
  //   icon: 'pay-circle-o',
  //   path: 'assetsManagement',
  //   authority: () => hasAuthority('/assetsManagement'),
  //   children: [
  //     {
  //       name: '总列表',
  //       path: 'totalList',
  //       authority: () => hasAuthority('/assetsManagement/totalList'),
  //     }, {
  //       name: '待放款',
  //       path: 'withdrawCreated',
  //       // extra: (openKeys, props) => {
  //       //   const count = props.noticeCount;
  //       //   if (openKeys.indexOf('assetsManagement') > -1) {
  //       //     return (<Badge style={{ marginTop: '-3px', marginLeft: '18px', boxShadow: '0 0 0 2px #fff' }} count={count} />);
  //       //   }
  //       //   return null;
  //       // },
  //       authority: () => hasAuthority('/assetsManagement/withdrawCreated'),
  //     }, {
  //       name: '放款中',
  //       path: 'withdrawTransferring',
  //       authority: () => hasAuthority('/assetsManagement/withdrawTransferring'),
  //     }, {
  //       name: '转账失败',
  //       path: 'withdrawTransferFail',
  //       authority: () => hasAuthority('/assetsManagement/withdrawTransferFail'),
  //     }, {
  //       name: '待还款',
  //       path: 'withdrawWaitToRepay',
  //       authority: () => hasAuthority('/assetsManagement/withdrawWaitToRepay'),
  //     }, {
  //       name: '已结清',
  //       path: 'withdrawHaveRepayed',
  //       authority: () => hasAuthority('/assetsManagement/withdrawHaveRepayed'),
  //     },
  //   ],
  // },

  // {
  //   name: '金融中心（想美）',
  //   icon: 'pay-circle-o',
  //   path: 'xbeautyManagement',
  //   authority: () => hasAuthority('/xbeautyManagement'),
  //   children: [
  //     {
  //       name: '总列表',
  //       path: 'totalList',
  //       authority: () => hasAuthority('/xbeautyManagement/totalList'),
  //     }, {
  //       name: '待放款',
  //       path: 'loanCreated',
  //       authority: () => hasAuthority('/xbeautyManagement/loanCreated'),
  //     }, {
  //       name: '放款中',
  //       path: 'loanTransferring',
  //       authority: () => hasAuthority('/xbeautyManagement/loanTransferring'),
  //     }, {
  //       name: '转账失败',
  //       path: 'loanTransferFail',
  //       authority: () => hasAuthority('/xbeautyManagement/loanTransferFail'),
  //     }, {
  //       name: '待还款',
  //       path: 'loanWaitToRepay',
  //       authority: () => hasAuthority('/xbeautyManagement/loanWaitToRepay'),
  //     }, {
  //       name: '已结清',
  //       path: 'loanHaveRepayed',
  //       authority: () => hasAuthority('/xbeautyManagement/loanHaveRepayed'),
  //     },
  //   ],
  // },
  // {
  //   name: '金融中心（信花花）',
  //   icon: 'pay-circle-o',
  //   path: 'assetsManagementForXflower',
  //   authority: () => hasAuthority('/assetsManagementForXflower'),
  //   children: [
  //     {
  //       name: '总列表',
  //       path: 'totalList',
  //       authority: () => hasAuthority('/assetsManagementForXflower/totalList'),
  //     }, {
  //       name: '待放款',
  //       path: 'loanCreated',
  //       authority: () => hasAuthority('/assetsManagementForXflower/loanCreated'),
  //     }, {
  //       name: '放款中',
  //       path: 'loanTransferring',
  //       authority: () => hasAuthority('/assetsManagementForXflower/loanTransferring'),
  //     }, {
  //       name: '转账失败',
  //       path: 'loanTransferFail',
  //       authority: () => hasAuthority('/assetsManagementForXflower/loanTransferFail'),
  //     }, {
  //       name: '待还款',
  //       path: 'loanWaitToRepay',
  //       authority: () => hasAuthority('/assetsManagementForXflower/loanWaitToRepay'),
  //     }, {
  //       name: '已结清',
  //       path: 'loanHaveRepayed',
  //       authority: () => hasAuthority('/assetsManagementForXflower/loanHaveRepayed'),
  //     },
  //   ],
  // },
  // {
  //   name: '金融中心（有点）',
  //   icon: 'pay-circle-o',
  //   path: 'assetsManagementForUpoint',
  //   authority: () => hasAuthority('/assetsManagementForUpoint'),
  //   children: [
  //     {
  //       name: '总列表',
  //       path: 'totalList',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/totalList'),
  //     }, {
  //       name: '待放款',
  //       path: 'loanCreated',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/loanCreated'),
  //     }, {
  //       name: '放款中',
  //       path: 'loanTransferring',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/loanTransferring'),
  //     }, {
  //       name: '转账失败',
  //       path: 'loanTransferFail',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/loanTransferFail'),
  //     }, {
  //       name: '待还款',
  //       path: 'loanWaitToRepay',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/loanWaitToRepay'),
  //     }, {
  //       name: '已结清',
  //       path: 'loanHaveRepayed',
  //       authority: () => hasAuthority('/assetsManagementForUpoint/loanHaveRepayed'),
  //     },
  //   ],
  // },

  {
    name: '运营中心（sdfz）',
    icon: 'red-envelope',
    path: 'operatingCenter',
    authority: () => hasAuthority('/operatingCenter'),
    children: [
      {
        name: '红包配置',
        path: 'redPacketConfig',
        authority: () => hasAuthority('/operatingCenter/redPacketConfig'),
      },
      {
        name: '红包统计',
        path: 'redPacketStatistics',
        authority: () => hasAuthority('/operatingCenter/redPacketStatistics'),
      },
      {
        name: 'banner配置',
        path: 'bannerConfig',
        authority: () => hasAuthority('/operatingCenter/bannerConfig'),
      },
      {
        name: '闪屏配置',
        path: 'flickerScreen',
        authority: () => hasAuthority('/operatingCenter/flickerScreen'),
      },
      {
        name: '分类图标',
        path: 'classifyIcon',
        authority: () => hasAuthority('/operatingCenter/classifyIcon'),
      },
      {
        name: '首页图标',
        path: 'homepageIcon',
        authority: () => hasAuthority('/operatingCenter/homepageIcon'),
      },
      // {
      //   name: '贷超配置',
      //   path: 'loanSupermarket',
      //   authority: () => hasAuthority('/operatingCenter/loanSupermarket'),
      // },
      {
        name: '版本显示',
        path: 'stageConfig',
        authority: () => hasAuthority('/operatingCenter/stageConfig'),
      },
      {
        name: '功能槽配置',
        path: 'functionSlot',
        authority: () => hasAuthority('/operatingCenter/functionSlot'),
      },
    ],
  },

  // {
  //   name: '运营中心（想美）',
  //   icon: 'red-envelope',
  //   path: 'operatingCenterForXbeauty',
  //   authority: () => hasAuthority('/operatingCenterForXbeauty'),
  //   children: [
  //     {
  //       name: 'banner配置',
  //       path: 'bannerConfig',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/bannerConfig'),
  //     },
  //     {
  //       name: '闪屏配置',
  //       path: 'flickerScreen',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/flickerScreen'),
  //     },
  //     {
  //       name: '首页图标',
  //       path: 'homepageIcon',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/homepageIcon'),
  //     },
  //     {
  //       name: '贷超配置',
  //       path: 'loanSupermarket',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/loanSupermarket'),
  //     },
  //     {
  //       name: '版本显示',
  //       path: 'stageConfig',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/stageConfig'),
  //     },
  //     {
  //       name: '功能槽配置',
  //       path: 'functionSlot',
  //       authority: () => hasAuthority('/operatingCenterForXbeauty/functionSlot'),
  //     },
  //   ],
  // },
  // {
  //   name: '运营中心（信花花）',
  //   icon: 'red-envelope',
  //   path: 'operatingCenterForXflower',
  //   authority: () => hasAuthority('/operatingCenterForXflower'),
  //   children: [
  //     {
  //       name: 'banner配置',
  //       path: 'bannerConfig',
  //       authority: () => hasAuthority('/operatingCenterForXflower/bannerConfig'),
  //     },
  //     {
  //       name: '闪屏配置',
  //       path: 'flickerScreen',
  //       authority: () => hasAuthority('/operatingCenterForXflower/flickerScreen'),
  //     },
  //     {
  //       name: '首页图标',
  //       path: 'homepageIcon',
  //       authority: () => hasAuthority('/operatingCenterForXflower/homepageIcon'),
  //     },
  //     {
  //       name: '贷超配置',
  //       path: 'loanSupermarket',
  //       authority: () => hasAuthority('/operatingCenterForXflower/loanSupermarket'),
  //     },
  //     {
  //       name: '版本显示',
  //       path: 'stageConfig',
  //       authority: () => hasAuthority('/operatingCenterForXflower/stageConfig'),
  //     },
  //     {
  //       name: '功能槽配置',
  //       path: 'functionSlot',
  //       authority: () => hasAuthority('/operatingCenterForXflower/functionSlot'),
  //     },
  //   ],
  // },
  // {
  //   name: '运营中心（有点）',
  //   icon: 'red-envelope',
  //   path: 'operatingCenterForUpoint',
  //   authority: () => hasAuthority('/operatingCenterForUpoint'),
  //   children: [
  //     {
  //       name: 'banner配置',
  //       path: 'bannerConfig',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/bannerConfig'),
  //     },
  //     {
  //       name: '闪屏配置',
  //       path: 'flickerScreen',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/flickerScreen'),
  //     },
  //     {
  //       name: '首页图标',
  //       path: 'homepageIcon',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/homepageIcon'),
  //     },
  //     {
  //       name: '贷超配置',
  //       path: 'loanSupermarket',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/loanSupermarket'),
  //     },
  //     {
  //       name: '版本显示',
  //       path: 'stageConfig',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/stageConfig'),
  //     },
  //     {
  //       name: '功能槽配置',
  //       path: 'functionSlot',
  //       authority: () => hasAuthority('/operatingCenterForUpoint/functionSlot'),
  //     },
  //   ],
  // },
  // {
  //   name: '风控中心',
  //   icon: 'global',
  //   path: 'riskCenter',
  //   authority: () => hasAuthority('/riskCenter'),
  //   children: [
  //     {
  //       name: '风控检测',
  //       path: 'riskDetection',
  //       authority: () => hasAuthority('/riskCenter/riskDetection'),
  //     },
  //   ],
  // },
  // {
  //   name: '数据中心',
  //   icon: 'global',
  //   path: 'dataManagement',
  //   authority: () => hasAuthority('/dataManagement'),
  //   children: [
  //     {
  //       name: '数据概览',
  //       path: 'dataOverView',
  //       authority: () => hasAuthority('/dataManagement/dataOverView'),
  //     }, {
  //       name: '平台分析',
  //       path: 'platformAnalysis',
  //       authority: () => hasAuthority('/dataManagement/platformAnalysis'),
  //     }, {
  //       name: '商品分析',
  //       path: 'productAnalysis',
  //       authority: () => hasAuthority('/dataManagement/productAnalysis'),
  //     },
  //   ],
  // },

  {
    name: '评价中心',
    icon: 'smile-o',
    path: 'evaluationManagement',
    authority: () => hasAuthority('/evaluationManagement'),
    children: [
      {
        name: '全部评价',
        path: 'all',
        authority: () => hasAuthority('/evaluationManagement/all'),
      }, {
        name: '好评',
        path: 'good',
        authority: () => hasAuthority('/evaluationManagement/good'),
      }, {
        name: '中评',
        path: 'normal',
        authority: () => hasAuthority('/evaluationManagement/normal'),
      }, {
        name: '好评',
        path: 'bad',
        authority: () => hasAuthority('/evaluationManagement/bad'),
      },
    ],
  },

  {
    name: '物流中心',
    icon: 'car',
    path: 'deliverManagement',
    authority: () => hasAuthority('/deliverManagement'),
  },

  {
    name: '营销中心',
    icon: 'customer-service',
    path: 'marketManagement',
    authority: () => hasAuthority('/marketManagement'),
  },

  {
    name: '系统管理',
    icon: 'setting',
    path: 'systemManagement',
    authority: () => hasAuthority('/systemManagement'),
    children: [
      {
        name: '用户',
        path: 'systemUser',
        authority: () => hasAuthority('/systemManagement/systemUser'),
      }, {
        name: '部门',
        path: 'systemOrganization',
        authority: () => hasAuthority('/systemManagement/systemOrganization'),
      }, {
        name: '角色',
        path: 'systemRole',
        authority: () => hasAuthority('/systemManagement/systemRole'),
      }, {
        name: '权限',
        path: 'systemAuth',
        authority: () => hasAuthority('/systemManagement/systemAuth'),
      },
    ],
  },
];

function formatter(data, parentPath = '', parentAuthority) {
  return data.map((item) => {
    const result = {
      ...item,
      path: `${parentPath}${item.path}`,
      authority: item.authority || parentAuthority,
    };
    if (item.children) {
      result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority);
    }
    return result;
  });
}

export const getMenuData = () => formatter(menuData);
